Skip to content

Conversation

@dblnz
Copy link
Contributor

@dblnz dblnz commented Jul 22, 2025

Description

This PR takes care of enabling the compilation of gdb_jit_int module in the jit-debug crate to ensure the native debugging also works in no_std environments.

My aim is to have this in for the LTS version 36.0.0 😃

This work has been discussed in #wasmtime > Debugging a wasm module in a hyperlight guest.

Summary

  • Make jit-debug crate #![no_std] when perf_jitdebug is not enabled
  • Make gdb_jit_int module build in no_std environment
  • Use std when perf_jitdebug is enabled because the perf_jitdebug module does not run in no_std environment
  • Split debug-builtins feature into debug-builtins and perf-builtins to individually toggle:
    • the no_std gdb_jit_int module by using debug-builtins
    • the std perf_jitdebug module using perf-builtins. NOTE: They can be both enabled, but it won't support no_std.

@dblnz dblnz requested review from a team as code owners July 22, 2025 19:32
@dblnz dblnz requested review from alexcrichton and removed request for a team July 22, 2025 19:32
@dblnz dblnz force-pushed the no-std-debug-builtins branch from b63d425 to 21981ef Compare July 22, 2025 19:55
- Make jit-debug crate #![no_std] when `std` feature is not enabled
- Make gdb_jit_int module build in no_std environment
- Use std when perf_jitdebug is enabled because the perf_jitdebug module
  does not run in no_std environment
- Change debug-builtins feature to only enable gdb_jit_int
- The perf_jitdebug feature is enabled in profiling mode only

Signed-off-by: Doru Blânzeanu <[email protected]>
@dblnz dblnz force-pushed the no-std-debug-builtins branch from 6bb53bf to 9363203 Compare July 24, 2025 23:36
@dblnz dblnz requested a review from alexcrichton July 25, 2025 12:27
These are otherwise present via `std`.
* Enable `wasmtime-jit-debug/std` from wasmtime's `std` feature
* Only enable `perf_jitdump` from `profiling` as that's all that's
  explicitly needed.
@alexcrichton
Copy link
Member

I've pushed a few commits as feedback here. Mind double-checking them and confirming they're ok for you?

@dblnz
Copy link
Contributor Author

dblnz commented Jul 28, 2025

I've pushed a few commits as feedback here. Mind double-checking them and confirming they're ok for you?

It looks good from my point of view.

Nice touch with the use of optional feature enablement.

"wasmtime-jit-debug?/std",

@alexcrichton alexcrichton added this pull request to the merge queue Jul 28, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jul 28, 2025
@alexcrichton alexcrichton added this pull request to the merge queue Jul 29, 2025
Merged via the queue into bytecodealliance:main with commit 74efac7 Jul 29, 2025
43 checks passed
bongjunj pushed a commit to prosyslab/wasmtime that referenced this pull request Oct 20, 2025
bytecodealliance#11304)

* Allow compiling debug-builtins in no_std environment to enable gdb jit

- Make jit-debug crate #![no_std] when `std` feature is not enabled
- Make gdb_jit_int module build in no_std environment
- Use std when perf_jitdebug is enabled because the perf_jitdebug module
  does not run in no_std environment
- Change debug-builtins feature to only enable gdb_jit_int
- The perf_jitdebug feature is enabled in profiling mode only

Signed-off-by: Doru Blânzeanu <[email protected]>

* Remove feature listing from `default`

These are otherwise present via `std`.

* Shuffle around some features

* Enable `wasmtime-jit-debug/std` from wasmtime's `std` feature
* Only enable `perf_jitdump` from `profiling` as that's all that's
  explicitly needed.

* Remove empty features list

* Cut down on some `#[cfg]` usage

* Update comments in gdb_jit_int module

* Add CI checks that `debug-builtins` builds on no_std

* Fix missing has_host_compiler_backend when debug-builtins enabled

Signed-off-by: Doru Blânzeanu <[email protected]>

---------

Signed-off-by: Doru Blânzeanu <[email protected]>
Co-authored-by: Alex Crichton <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

wasmtime:api Related to the API of the `wasmtime` crate itself

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants